// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        canvas: cc.Node,
    },

    // LIFE-CYCLE CALLBACKS:

     onLoad ()
     {
         return;
         var self = this;
         self.moveToPos = cc.p(0, 0);
         self.isMoving = false;
         self.canvas.on(cc.Node.EventType.TOUCH_START, function (event) {
             var touches = event.getTouches();
             var touchLoc = touches[0].getLocation();
             cc.log(touches[0].getLocation());
         }, self.node);
         self.canvas.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
             var touches = event.getTouches();
             var touchLoc = touches[0].getLocation();
             cc.log(touches[0].getLocation());
         }, self.node);
         self.canvas.on(cc.Node.EventType.TOUCH_END, function (event) {
             cc.log(touches[0].getLocation());
         }, self.node);
     },


    onTouchStart(event){

        let touches =event.getTouches();
        cc.log(touches[0].getLocation());

    },
    onTouchMove(event){
        let touches =event.getTouches();
        cc.log(touches[0].getLocation());

    },
    onTouchEnd(event){
        let touches =event.getTouches();
        cc.log(touches[0].getLocation());
    },

    start () {

    },

    onDestroy(){

        cc.systemEvent.off(cc.Node.EventType.TOUCH_START,this.onTouchStart,this.node);
        cc.systemEvent.off(cc.Node.EventType.TOUCH_MOVE,this.onTouchMove,this.node);
        cc.systemEvent.off(cc.Node.EventType.TOUCH_END,this.onTouchEnd,this.node);

    },

    // update (dt) {},
});
